from bottle import route, request, redirect

# ========== 路由装饰器包装器 ==========
def app_route(path, method=['GET']):
    def decorator(func):
        def wrapper(*args, **kwargs):
            return func(*args, **kwargs)

        # 如果 method 是字符串，转为列表统一处理
        methods = method if isinstance(method, (list, tuple)) else [method]
        for m in methods:
            route(path, method=m)(wrapper)
        return wrapper
    return decorator